//
//  BaseTableViewController.swift
//  mySina
//
//  Created by mac on 15/12/17.
//  Copyright © 2015年 tz. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLogViewDelegate {
    //定义一个用户是否登录的标记
    var userLogin = UserAccountViewModel().userLogin
    //访客视图的属性
    var visitorLogView: VisitorLogView?
    //苹果专门为纯手码写得，一旦运行此方法，那么xib/sb自动失效
    override func loadView() {
        if userLogin {
            super.loadView()
        } else {
            setVisitorLogView()
        }
    }
    private func setVisitorLogView() {
        visitorLogView = VisitorLogView()
        //设置代理
        visitorLogView?.visitorLogViewDelegate = self
        view = visitorLogView
    }
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    func userWillRegister() {
        print(__FUNCTION__)
    }
    func userWillLogin() {
        let oath = OAuthViewController()
        //添加到导航视图
        let nav = UINavigationController(rootViewController: oath)
        presentViewController(nav, animated: true, completion: nil)
    }
}
